home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / comms / other / amivnc / d3des.c < prev    next >
C/C++ Source or Header  |  1999-06-14  |  15KB  |  433 lines

  1. /*
  2.  * This is D3DES (V5.09) by Richard Outerbridge with the double and
  3.  * triple-length support removed for use in VNC.  Also the bytebit[] array
  4.  * has been reversed so that the most significant bit in each byte of the
  5.  * key is ignored, not the least significant.
  6.  *
  7.  * These changes are Copyright (C) 1998 Olivetti & Oracle Research Laboratory
  8.  *
  9.  * This software is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12.  */
  13.  
  14. /* D3DES (V5.09) -
  15.  *
  16.  * A portable, public domain, version of the Data Encryption Standard.
  17.  *
  18.  * Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
  19.  * Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
  20.  * code;  Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
  21.  * Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
  22.  * for humouring me on.
  23.  *
  24.  * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
  25.  * (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
  26.  */
  27.  
  28. #include "d3des.h"
  29.  
  30. static void scrunch(unsigned char *, unsigned long *);
  31. static void unscrun(unsigned long *, unsigned char *);
  32. static void desfunc(unsigned long *, unsigned long *);
  33. static void cookey(unsigned long *);
  34.  
  35. static unsigned long KnL[32] = { 0L };
  36. static unsigned short bytebit[8]    = {
  37.     01, 02, 04, 010, 020, 040, 0100, 0200 };
  38.  
  39. static unsigned long bigbyte[24] = {
  40.     0x800000L,    0x400000L,    0x200000L,    0x100000L,
  41.     0x80000L,    0x40000L,    0x20000L,    0x10000L,
  42.     0x8000L,    0x4000L,    0x2000L,    0x1000L,
  43.     0x800L,     0x400L,     0x200L,     0x100L,
  44.     0x80L,        0x40L,        0x20L,        0x10L,
  45.     0x8L,        0x4L,        0x2L,        0x1L    };
  46.  
  47. /* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
  48.  
  49. static unsigned char pc1[56] = {
  50.     56, 48, 40, 32, 24, 16,  8,     0, 57, 49, 41, 33, 25, 17,
  51.      9,  1, 58, 50, 42, 34, 26,    18, 10,  2, 59, 51, 43, 35,
  52.     62, 54, 46, 38, 30, 22, 14,     6, 61, 53, 45, 37, 29, 21,
  53.     13,  5, 60, 52, 44, 36, 28,    20, 12,  4, 27, 19, 11,  3 };
  54.  
  55. static unsigned char totrot[16] = {
  56.     1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
  57.  
  58. static unsigned char pc2[48] = {
  59.     13, 16, 10, 23,  0,  4,  2, 27, 14,  5, 20,  9,
  60.     22, 18, 11,  3, 25,  7, 15,  6, 26, 19, 12,  1,
  61.     40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
  62.     43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
  63.  
  64. void deskey(key, edf)    /* Thanks to James Gillogly & Phil Karn! */
  65. unsigned char *key;
  66. int edf;
  67. {
  68.     register int i, j, l, m, n;
  69.     unsigned char pc1m[56], pcr[56];
  70.     unsigned long kn[32];
  71.  
  72.     for ( j = 0; j < 56; j++ ) {
  73.         l = pc1[j];
  74.         m = l & 07;
  75.         pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
  76.         }
  77.     for( i = 0; i < 16; i++ ) {
  78.         if( edf == DE1 ) m = (15 - i) << 1;
  79.         else m = i << 1;
  80.         n = m + 1;
  81.         kn[m] = kn[n] = 0L;
  82.         for( j = 0; j < 28; j++ ) {
  83.             l = j + totrot[i];
  84.             if( l < 28 ) pcr[j] = pc1m[l];
  85.             else pcr[j] = pc1m[l - 28];
  86.             }
  87.         for( j = 28; j < 56; j++ ) {
  88.             l = j + totrot[i];
  89.             if( l < 56 ) pcr[j] = pc1m[l];
  90.             else pcr[j] = pc1m[l - 28];
  91.             }
  92.         for( j = 0; j < 24; j++ ) {
  93.             if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
  94.             if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
  95.             }
  96.         }
  97.     cookey(kn);
  98.     return;
  99.     }
  100.  
  101. static void cookey(raw1)
  102. register unsigned long *raw1;
  103. {
  104.     register unsigned long *cook, *raw0;
  105.     unsigned long dough[32];
  106.     register int i;
  107.  
  108.     cook = dough;
  109.     for( i = 0; i < 16; i++, raw1++ ) {
  110.         raw0 = raw1++;
  111.         *cook     = (*raw0 & 0x00fc0000L) << 6;
  112.         *cook    |= (*raw0 & 0x00000fc0L) << 10;
  113.         *cook    |= (*raw1 & 0x00fc0000L) >> 10;
  114.         *cook++ |= (*raw1 & 0x00000fc0L) >> 6;
  115.         *cook     = (*raw0 & 0x0003f000L) << 12;
  116.         *cook    |= (*raw0 & 0x0000003fL) << 16;
  117.         *cook    |= (*raw1 & 0x0003f000L) >> 4;
  118.         *cook++ |= (*raw1 & 0x0000003fL);
  119.         }
  120.     usekey(dough);
  121.     return;
  122.     }
  123.  
  124. void cpkey(into)
  125. register unsigned long *into;
  126. {
  127.     register unsigned long *from, *endp;
  128.  
  129.     from = KnL, endp = &KnL[32];
  130.     while( from < endp ) *into++ = *from++;
  131.     return;
  132.     }
  133.  
  134. void usekey(from)
  135. register unsigned long *from;
  136. {
  137.     register unsigned long *to, *endp;
  138.  
  139.     to = KnL, endp = &KnL[32];
  140.     while( to < endp ) *to++ = *from++;
  141.     return;
  142.     }
  143.  
  144. void des(inblock, outblock)
  145. unsigned char *inblock, *outblock;
  146. {
  147.     unsigned long work[2];
  148.  
  149.     scrunch(inblock, work);
  150.     desfunc(work, KnL);
  151.     unscrun(work, outblock);
  152.     return;
  153.     }
  154.  
  155. static void scrunch(outof, into)
  156. register unsigned char *outof;
  157. register unsigned long *into;
  158. {
  159.     *into     = (*outof++ & 0xffL) << 24;
  160.     *into    |= (*outof++ & 0xffL) << 16;
  161.     *into    |= (*outof++ & 0xffL) << 8;
  162.     *into++ |= (*outof++ & 0xffL);
  163.     *into     = (*outof++ & 0xffL) << 24;
  164.     *into    |= (*outof++ & 0xffL) << 16;
  165.     *into    |= (*outof++ & 0xffL) << 8;
  166.     *into    |= (*outof   & 0xffL);
  167.     return;
  168.     }
  169.  
  170. static void unscrun(outof, into)
  171. register unsigned long *outof;
  172. register unsigned char *into;
  173. {
  174.     *into++ = (*outof >> 24) & 0xffL;
  175.     *into++ = (*outof >> 16) & 0xffL;
  176.     *into++ = (*outof >>  8) & 0xffL;
  177.     *into++ =  *outof++     & 0xffL;
  178.     *into++ = (*outof >> 24) & 0xffL;
  179.     *into++ = (*outof >> 16) & 0xffL;
  180.     *into++ = (*outof >>  8) & 0xffL;
  181.     *into    =  *outof     & 0xffL;
  182.     return;
  183.     }
  184.  
  185. static unsigned long SP1[64] = {
  186.     0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
  187.     0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
  188.     0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
  189.     0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
  190.     0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
  191.     0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
  192.     0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
  193.     0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
  194.     0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
  195.     0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
  196.     0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
  197.     0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
  198.     0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
  199.     0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
  200.     0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
  201.     0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
  202.  
  203. static unsigned long SP2[64] = {
  204.     0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
  205.     0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
  206.     0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
  207.     0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
  208.     0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
  209.     0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
  210.     0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
  211.     0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
  212.     0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
  213.     0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
  214.     0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
  215.     0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
  216.     0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
  217.     0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
  218.     0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
  219.     0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
  220.  
  221. static unsigned long SP3[64] = {
  222.     0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
  223.     0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
  224.     0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
  225.     0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
  226.     0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
  227.     0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
  228.     0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
  229.     0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
  230.     0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
  231.     0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
  232.     0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
  233.     0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
  234.     0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
  235.     0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
  236.     0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
  237.     0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
  238.  
  239. static unsigned long SP4[64] = {
  240.     0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
  241.     0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
  242.     0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
  243.     0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
  244.     0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
  245.     0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
  246.     0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
  247.     0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
  248.     0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
  249.     0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
  250.     0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
  251.     0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
  252.     0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
  253.     0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
  254.     0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
  255.     0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
  256.  
  257. static unsigned long SP5[64] = {
  258.     0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
  259.     0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
  260.     0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
  261.     0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
  262.     0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
  263.     0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
  264.     0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
  265.     0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
  266.     0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
  267.     0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
  268.     0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
  269.     0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
  270.     0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
  271.     0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
  272.     0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
  273.     0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
  274.  
  275. static unsigned long SP6[64] = {
  276.     0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
  277.     0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
  278.     0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
  279.     0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
  280.     0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
  281.     0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
  282.     0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
  283.     0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
  284.     0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
  285.     0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
  286.     0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
  287.     0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
  288.     0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
  289.     0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
  290.     0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
  291.     0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
  292.  
  293. static unsigned long SP7[64] = {
  294.     0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
  295.     0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
  296.     0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
  297.     0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
  298.     0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
  299.     0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
  300.     0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
  301.     0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
  302.     0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
  303.     0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
  304.     0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
  305.     0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
  306.     0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
  307.     0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
  308.     0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
  309.     0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
  310.  
  311. static unsigned long SP8[64] = {
  312.     0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
  313.     0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
  314.     0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
  315.     0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
  316.     0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
  317.     0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
  318.     0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
  319.     0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
  320.     0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
  321.     0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
  322.     0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
  323.     0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
  324.     0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
  325.     0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
  326.     0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
  327.     0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
  328.  
  329. static void desfunc(block, keys)
  330. register unsigned long *block, *keys;
  331. {
  332.     register unsigned long fval, work, right, leftt;
  333.     register int round;
  334.  
  335.     leftt = block[0];
  336.     right = block[1];
  337.     work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
  338.     right ^= work;
  339.     leftt ^= (work << 4);
  340.     work = ((leftt >> 16) ^ right) & 0x0000ffffL;
  341.     right ^= work;
  342.     leftt ^= (work << 16);
  343.     work = ((right >> 2) ^ leftt) & 0x33333333L;
  344.     leftt ^= work;
  345.     right ^= (work << 2);
  346.     work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
  347.     leftt ^= work;
  348.     right ^= (work << 8);
  349.     right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
  350.     work = (leftt ^ right) & 0xaaaaaaaaL;
  351.     leftt ^= work;
  352.     right ^= work;
  353.     leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
  354.  
  355.     for( round = 0; round < 8; round++ ) {
  356.         work  = (right << 28) | (right >> 4);
  357.         work ^= *keys++;
  358.         fval  = SP7[ work         & 0x3fL];
  359.         fval |= SP5[(work >>  8) & 0x3fL];
  360.         fval |= SP3[(work >> 16) & 0x3fL];
  361.         fval |= SP1[(work >> 24) & 0x3fL];
  362.         work  = right ^ *keys++;
  363.         fval |= SP8[ work         & 0x3fL];
  364.         fval |= SP6[(work >>  8) & 0x3fL];
  365.         fval |= SP4[(work >> 16) & 0x3fL];
  366.         fval |= SP2[(work >> 24) & 0x3fL];
  367.         leftt ^= fval;
  368.         work  = (leftt << 28) | (leftt >> 4);
  369.         work ^= *keys++;
  370.         fval  = SP7[ work         & 0x3fL];
  371.         fval |= SP5[(work >>  8) & 0x3fL];
  372.         fval |= SP3[(work >> 16) & 0x3fL];
  373.         fval |= SP1[(work >> 24) & 0x3fL];
  374.         work  = leftt ^ *keys++;
  375.         fval |= SP8[ work         & 0x3fL];
  376.         fval |= SP6[(work >>  8) & 0x3fL];
  377.         fval |= SP4[(work >> 16) & 0x3fL];
  378.         fval |= SP2[(work >> 24) & 0x3fL];
  379.         right ^= fval;
  380.         }
  381.  
  382.     right = (right << 31) | (right >> 1);
  383.     work = (leftt ^ right) & 0xaaaaaaaaL;
  384.     leftt ^= work;
  385.     right ^= work;
  386.     leftt = (leftt << 31) | (leftt >> 1);
  387.     work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
  388.     right ^= work;
  389.     leftt ^= (work << 8);
  390.     work = ((leftt >> 2) ^ right) & 0x33333333L;
  391.     right ^= work;
  392.     leftt ^= (work << 2);
  393.     work = ((right >> 16) ^ leftt) & 0x0000ffffL;
  394.     leftt ^= work;
  395.     right ^= (work << 16);
  396.     work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
  397.     leftt ^= work;
  398.     right ^= (work << 4);
  399.     *block++ = right;
  400.     *block = leftt;
  401.     return;
  402.     }
  403.  
  404. /* Validation sets:
  405.  *
  406.  * Single-length key, single-length plaintext -
  407.  * Key      : 0123 4567 89ab cdef
  408.  * Plain  : 0123 4567 89ab cde7
  409.  * Cipher : c957 4425 6a5e d31d
  410.  *
  411.  * Double-length key, single-length plaintext -
  412.  * Key      : 0123 4567 89ab cdef fedc ba98 7654 3210
  413.  * Plain  : 0123 4567 89ab cde7
  414.  * Cipher : 7f1d 0a77 826b 8aff
  415.  *
  416.  * Double-length key, double-length plaintext -
  417.  * Key      : 0123 4567 89ab cdef fedc ba98 7654 3210
  418.  * Plain  : 0123 4567 89ab cdef 0123 4567 89ab cdff
  419.  * Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
  420.  *
  421.  * Triple-length key, single-length plaintext -
  422.  * Key      : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
  423.  * Plain  : 0123 4567 89ab cde7
  424.  * Cipher : de0b 7c06 ae5e 0ed5
  425.  *
  426.  * Triple-length key, double-length plaintext -
  427.  * Key      : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
  428.  * Plain  : 0123 4567 89ab cdef 0123 4567 89ab cdff
  429.  * Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
  430.  *
  431.  * d3des V5.0a rwo 9208.07 18:44 Graven Imagery
  432.  **********************************************************************/
  433.